import request from '@/config/axios'

// 定义类型
export interface Node {
  id: string;
  name: string;
  group: number;
  size?: number;
}

export interface Link {
  source: string;
  target: string;
  value: number;
}

export interface GraphData {
  nodes: Node[];
  links: Link[];
}

// 定义axios响应类型
export interface ApiResponse<T> {
  code: number;
  data: T;
  message?: string;
}

// 超级关系--节点信息 API
export const RelationshipApi = {
  // 查询超级关系--节点信息分页
  getGraph: async (personId: string): Promise<GraphData> => {
    // 注意：参数名应为id，与后端@RequestParam(name = "id")保持一致
    return await request.get({
      url: '/member/graph/data',
      params: { id: personId }  // 使用params传递查询参数，参数名为id
    })
  }
}


